home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / ImageFXDevKit.lha / sdev / sas / examples / savers / skeleton.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-01  |  4.5 KB  |  172 lines

  1. /*
  2.  * Skeleton Saver Module
  3.  */
  4.  
  5. #include <exec/types.h>
  6. #include <dos/dos.h>
  7. #include <libraries/iffparse.h>
  8. #include <devices/clipboard.h>
  9. #include <clib/dos_protos.h>
  10. #include <clib/exec_protos.h>
  11.  
  12. #include <scan/modall.h>
  13. #include <scan/loadsave.h>
  14.  
  15. /**************************************************************************
  16.  * SM_SaveTrue()
  17.  *
  18.  * Write out a true color image buffer in the format that this module
  19.  * saves in.
  20.  *
  21.  * The Buffer structure is defined in scan/buf.h.
  22.  */
  23.  
  24. BOOL __saveds __asm SM_SaveTrue (register __a0 char *fname,
  25.                                  register __a1 struct Buffer *buf,
  26.                                  register __d0 int id,
  27.                                  register __a2 LONG *args)
  28. {
  29.    Errorf("SM_SaveTrue");
  30.    ReturnError(ERR_UserCancel, FALSE);
  31. }
  32.  
  33. /*************************************************************************
  34.  * SM_SaveMapped()
  35.  *
  36.  * Save out a rendered image in the format that this saver saves in.
  37.  *
  38.  * The MappedImage structure is defined in scan/loadsave.h.
  39.  */
  40.  
  41. BOOL __saveds __asm SM_SaveMapped (register __a0 char *fname,
  42.                                    register __a1 struct MappedImage *img,
  43.                                    register __d0 int id,
  44.                                    register __a2 LONG *args)
  45. {
  46.    Errorf("SM_SaveMapped");
  47.    ReturnError(ERR_UserCancel, FALSE);
  48. }
  49.  
  50.  
  51. /**************************************************************************
  52.  * SM_SavePalette()
  53.  *
  54.  * Save just a palette in the format that this module saves in.  Currently
  55.  * ImageFX never saves a palette in anything but ILBM, but one never
  56.  * knows.
  57.  *
  58.  * The Palette structure is defined in scan/loadsave.h.
  59.  */
  60.  
  61. BOOL __saveds __asm SM_SavePalette (register __a0 char *fname,
  62.                                     register __a1 struct Palette *palette,
  63.                                     register __d0 int id)
  64. {
  65.    return(FALSE);
  66. }
  67.  
  68. /*
  69.  * This array is passed back to Image Scan to tell it what kinds of
  70.  * file formats we can save.  It also tells Image Scan whether or not
  71.  * we can handle True Color Buffers, Rendered Images, or Palettes, or
  72.  * any combination thereof.  See the include file scan/loadsave.h for
  73.  * details about the SaveFormat structure and its arguments.
  74.  */
  75.  
  76. static
  77. struct SaveFormat saveformats[] = {
  78.    { "Skeleton", SAV_TRUE | SAV_MAPPED,   0 },
  79.    { NULL }
  80. };
  81.  
  82. /************************************************************************
  83.  * SM_Signatures()
  84.  *
  85.  * Tell Image Scan what kinds of formats we can save.
  86.  */
  87.  
  88. struct SaveFormat * __saveds SM_Signatures (void)
  89. {
  90.    return(saveformats);
  91. }
  92.  
  93.  
  94. /**********************************************************************\
  95.  
  96.                Library Functions and Initialization Stuff
  97.  
  98. \**********************************************************************/
  99.  
  100.  
  101. /************************************************************************
  102.  * Function table.  Referenced in "lib.o".
  103.  *
  104.  * The first four entries are the standard library vectors, defined
  105.  * in "lib.o", the remaining entries define functions specific to
  106.  * this module.
  107.  *
  108.  * The table ends with -1.
  109.  *
  110.  */
  111. ULONG FuncTable[] = {
  112.    /* These four MUST be present */
  113.    (ULONG) LibOpen,
  114.    (ULONG) LibClose,
  115.    (ULONG) LibExpunge,
  116.    (ULONG) LibNull,
  117.  
  118.    (ULONG) 0,                 /* unused */
  119.    (ULONG) SM_SaveTrue,
  120.    (ULONG) SM_SaveMapped,
  121.    (ULONG) SM_SavePalette,
  122.    (ULONG) SM_Signatures,
  123.  
  124.    /* End with -1L */
  125.    (ULONG) -1L
  126. };
  127.  
  128. /************************************************************************
  129.  * ID string for this module.  References in "lib.o".
  130.  *
  131.  * Should be given in the standard 2.0 version string style.
  132.  */
  133. UBYTE LibraryID[]    = "$VER: Skeleton 1.03.00 (12.11.92)";
  134.  
  135. /************************************************************************
  136.  * Type of module.  Referenced in "lib.o".
  137.  *
  138.  * Should be one of the NT_* defines in <scan/mod.h>
  139.  *
  140.  */
  141. UBYTE LibraryType    = NT_SAVER;
  142.  
  143. /************************************************************************
  144.  * Module initialization code.  Referenced by "lib.o".
  145.  *
  146.  * This is where you would initialize the ModuleBase structure that
  147.  * is passed to you.
  148.  *
  149.  * Returns TRUE if all went well, or FALSE if something went wrong and
  150.  * the module open should fail.
  151.  *
  152.  */
  153. LONG __saveds __stdargs UserOpen (struct ModuleBase *modbase)
  154. {
  155.    return(TRUE);
  156. }
  157.  
  158. /************************************************************************
  159.  * Module cleanup code.  Referenced by "lib.o".
  160.  *
  161.  * This should cleanup anything you allocated or opened in UserOpen()
  162.  * above.
  163.  *
  164.  * Always return TRUE.
  165.  *
  166.  */
  167. LONG __saveds __stdargs UserClose (struct ModuleBase *modbase)
  168. {
  169.    return(TRUE);
  170. }
  171.  
  172.